home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 July / macformat52.iso / mac / Shareware Plus / Developers / YAAF v1.0 alpha 1 / Headers / Core / XPrinter.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-24  |  3.4 KB  |  146 lines

  1. /*    XPrinter.h
  2.  *
  3.  *        This is the interface for printing. This handles a standard
  4.  *    printing interface for both Windows and MacOS
  5.  */
  6.  
  7. /*  YAAF - Yet another application framework
  8.  *  Copyright (C) 1997 William Edward Woody and In Phase Consulting
  9.  *  
  10.  *  This library is free software; you can redistribute it
  11.  *  and/or modify it under the terms of the GNU Library
  12.  *  General Public License as published by the Free Software
  13.  *  Foundation; either version 2 of the License, or any
  14.  *  later version.
  15.  *  
  16.  *  This library is distributed in the hope that it will be
  17.  *  useful, but WITHOUT ANY WARRANTY; without even the implied
  18.  *  warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
  19.  *  PURPOSE. See the GNU Library General Public License for
  20.  *  more details.
  21.  *  
  22.  *  You should have received a copy of the GNU Library General
  23.  *  Public License along with this library; if not, write to the
  24.  *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  25.  *  Boston, MA 02111-1307, USA.
  26.  *  
  27.  *  To contact the author, either e-mail me at
  28.  *  woody@alumni.caltech.edu, or write to us at
  29.  *  
  30.  *          William Edward Woody
  31.  *          In Phase Consulting
  32.  *          1545 Ard Eevin Avenue
  33.  *          Glendale, CA 91202
  34.  */
  35.  
  36. #ifndef __XPRINTER_H__
  37. #define __XPRINTER_H__
  38.  
  39. #include <XView.h>
  40.  
  41. #if defined(__MWERKS__)
  42.     #if defined(macintosh)
  43.         #pragma options align=power
  44.     #endif
  45.     #if defined(__INTEL__)
  46.         #pragma pack(push,2)
  47.     #endif
  48. #endif
  49.  
  50. /************************************************************************/
  51. /*                                                                        */
  52. /*    Constants                                                            */
  53. /*                                                                        */
  54. /************************************************************************/
  55.  
  56. #define    KTPDefault                0x8000
  57. #define KTPSquareResolution        0x0001
  58. #define KTPMaxResolution        0x0002
  59.  
  60. /************************************************************************/
  61. /*                                                                        */
  62. /*    Default menu commands                                                */
  63. /*                                                                        */
  64. /************************************************************************/
  65.  
  66. /*    XGPrinter
  67.  *
  68.  *        This is a printer interface. And no, we can only have one of
  69.  *    these at a time.
  70.  */
  71.  
  72. class XGPrinter {
  73.     public:
  74.                                 XGPrinter();
  75.         virtual                    ~XGPrinter();
  76.         
  77.         /*
  78.          *    Current Page size settings
  79.          */
  80.         
  81.         Rect                    PageSize();        // size of a page
  82.         Rect                    PrintSize();    // printing area in page
  83.         Point                    Resolution();    // Resolution of page
  84.         
  85.         /*
  86.          *    Set the resolution
  87.          */
  88.         
  89.         void                    SetResolution(short);
  90.         
  91.         /*
  92.          *    Run the dialog boxes
  93.          */
  94.          
  95.         bool                    PageSetup();
  96.         bool                    PrintJob(short *, short *);
  97.         
  98.         /*
  99.          *    Printing core
  100.          */
  101.         
  102.         bool                    StartJob(char *docname = NULL);
  103.         void                    EndJob();
  104.         bool                    StartPage();
  105.         void                    EndPage();
  106.         bool                    GetCancelState();
  107.         
  108.     private:
  109.  
  110. #if OPT_MACOS == 1
  111.         void                    OpenWindow(void);
  112.         
  113.         bool                    fPrinter;
  114.         THPrint                    fHPrint;
  115.         TPPrPort                fPort;
  116.         WindowPtr                fWindow;
  117. #endif
  118.  
  119. #if OPT_WINOS == 1
  120.         HDC                        fPrintDC;
  121.         PRINTDLG                fPrintData;
  122. #endif
  123.  
  124.     friend class XGDraw;
  125. };
  126.  
  127. /************************************************************************/
  128. /*                                                                        */
  129. /*    Globals                                                                */
  130. /*                                                                        */
  131. /************************************************************************/
  132.  
  133. extern XGPrinter    GPrinter;            /* The printer interface        */
  134.  
  135.  
  136. #if defined(__MWERKS__)
  137.     #if defined(macintosh)
  138.         #pragma options align=reset
  139.     #endif
  140.     #if defined(__INTEL__)
  141.         #pragma pack(pop)
  142.     #endif
  143. #endif
  144.  
  145. #endif
  146.